/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pyfntbpartida")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pyfntbpartida.findAll", query = "SELECT p FROM Pyfntbpartida p"),
    @NamedQuery(name = "Pyfntbpartida.findByPyfntbpartidaid", query = "SELECT p FROM Pyfntbpartida p WHERE p.pyfntbpartidaid = :pyfntbpartidaid"),
    @NamedQuery(name = "Pyfntbpartida.findByNombre", query = "SELECT p FROM Pyfntbpartida p WHERE p.nombre = :nombre"),
    @NamedQuery(name = "Pyfntbpartida.findByDescripcion", query = "SELECT p FROM Pyfntbpartida p WHERE p.descripcion = :descripcion"),
    @NamedQuery(name = "Pyfntbpartida.findByCodigo", query = "SELECT p FROM Pyfntbpartida p WHERE p.codigo = :codigo"),
    @NamedQuery(name = "Pyfntbpartida.findByObservaciones", query = "SELECT p FROM Pyfntbpartida p WHERE p.observaciones = :observaciones")})
public class Pyfntbpartida implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pyfntbpartidaid")
    private Integer pyfntbpartidaid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "descripcion")
    private String descripcion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "codigo")
    private String codigo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbpartidaid")
    private Collection<Pyfntbrequer> pyfntbrequerCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbpartidaid")
    private Collection<Pyfntbejegasto> pyfntbejegastoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbpartidaid")
    private Collection<Pyfntbreqviatico> pyfntbreqviaticoCollection;

    public Pyfntbpartida() {
    }

    public Pyfntbpartida(Integer pyfntbpartidaid) {
        this.pyfntbpartidaid = pyfntbpartidaid;
    }

    public Pyfntbpartida(Integer pyfntbpartidaid, String nombre, String descripcion, String codigo, String observaciones) {
        this.pyfntbpartidaid = pyfntbpartidaid;
        this.nombre = nombre;
        this.descripcion = descripcion;
        this.codigo = codigo;
        this.observaciones = observaciones;
    }

    public Integer getPyfntbpartidaid() {
        return pyfntbpartidaid;
    }

    public void setPyfntbpartidaid(Integer pyfntbpartidaid) {
        this.pyfntbpartidaid = pyfntbpartidaid;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    @XmlTransient
    public Collection<Pyfntbrequer> getPyfntbrequerCollection() {
        return pyfntbrequerCollection;
    }

    public void setPyfntbrequerCollection(Collection<Pyfntbrequer> pyfntbrequerCollection) {
        this.pyfntbrequerCollection = pyfntbrequerCollection;
    }

    @XmlTransient
    public Collection<Pyfntbejegasto> getPyfntbejegastoCollection() {
        return pyfntbejegastoCollection;
    }

    public void setPyfntbejegastoCollection(Collection<Pyfntbejegasto> pyfntbejegastoCollection) {
        this.pyfntbejegastoCollection = pyfntbejegastoCollection;
    }

    @XmlTransient
    public Collection<Pyfntbreqviatico> getPyfntbreqviaticoCollection() {
        return pyfntbreqviaticoCollection;
    }

    public void setPyfntbreqviaticoCollection(Collection<Pyfntbreqviatico> pyfntbreqviaticoCollection) {
        this.pyfntbreqviaticoCollection = pyfntbreqviaticoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pyfntbpartidaid != null ? pyfntbpartidaid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pyfntbpartida)) {
            return false;
        }
        Pyfntbpartida other = (Pyfntbpartida) object;
        if ((this.pyfntbpartidaid == null && other.pyfntbpartidaid != null) || (this.pyfntbpartidaid != null && !this.pyfntbpartidaid.equals(other.pyfntbpartidaid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pyfntbpartida[ pyfntbpartidaid=" + pyfntbpartidaid + " ]";
    }
    
}
